package com.bkgy.modular.test.exception;

import lombok.Data;

/**
 * 自定义业务异常类
 */
@Data
public class BusinessExceptionNew extends RuntimeException{
    /**
     * 错误编码
     */
    private String code;

    public BusinessExceptionNew(){
        super();
    }
    public BusinessExceptionNew(String msg){
        super(msg);
    }

    public BusinessExceptionNew(String code, String msg){
        super(msg);
        this.code = code;
    }

    public BusinessExceptionNew(Throwable cause){
        super(cause);
    }

    public BusinessExceptionNew(String message, Throwable cause){
        super(message,cause);
    }

    public BusinessExceptionNew(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace){
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code){
        this.code = code;
    }

    @Override
    public String getMessage(){
        return super.getMessage();
    }

    @Override
    public String toString() {
        return this.code + ":" + this.getMessage();
    }
}
